<?php
return [
    'default' => getenv('DEFAULT_DATABASE'),
    'connections' => [
        'biqi_business' => [
            'driver' => 'mysql',
            'host' => getenv('DB_BUSINESS_HOST'),
            'port' => getenv('DB_BUSINESS_PORT'),
            'database' => getenv('DB_BUSINESS_DATABASE'),
            'username' => getenv('DB_BUSINESS_USERNAME'),
            'password' => getenv('DB_BUSINESS_PASSWORD'),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_general_ci',
            'prefix' => '',
            'strict' => true,
            'engine' => null,
            'options' => [
                PDO::ATTR_EMULATE_PREPARES => false, // Must be false for Swoole and Swow drivers.
            ],
            'pool' => [
                'max_connections' => 5,
                'min_connections' => 1,
                'wait_timeout' => 3,
                'idle_timeout' => 60,
                'heartbeat_interval' => 50,
            ],
        ],
        'biqi_account' => [
            'driver' => 'mysql',
            'host' => getenv('DB_ACCOUNT_HOST'),
            'port' => getenv('DB_ACCOUNT_PORT'),
            'database' => getenv('DB_ACCOUNT_DATABASE'),
            'username' => getenv('DB_ACCOUNT_USERNAME'),
            'password' => getenv('DB_ACCOUNT_PASSWORD'),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_general_ci',
            'prefix' => '',
            'strict' => true,
            'engine' => null,
            'options' => [
                PDO::ATTR_EMULATE_PREPARES => false, // Must be false for Swoole and Swow drivers.
            ],
            'pool' => [
                'max_connections' => 5,
                'min_connections' => 1,
                'wait_timeout' => 3,
                'idle_timeout' => 60,
                'heartbeat_interval' => 50,
            ],
        ],
        'biqi_box' => [
            'driver' => 'mysql',
            'host' => getenv('DB_BOX_HOST'),
            'port' => getenv('DB_BOX_PORT'),
            'database' => getenv('DB_BOX_DATABASE'),
            'username' => getenv('DB_BOX_USERNAME'),
            'password' => getenv('DB_BOX_PASSWORD'),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_general_ci',
            'prefix' => '',
            'strict' => true,
            'engine' => null,
            'options' => [
                PDO::ATTR_EMULATE_PREPARES => false, // Must be false for Swoole and Swow drivers.
            ],
            'pool' => [
                'max_connections' => 5,
                'min_connections' => 1,
                'wait_timeout' => 3,
                'idle_timeout' => 60,
                'heartbeat_interval' => 50,
            ],
        ],
        'biqi_game' => [
            'driver' => 'mysql',
            'host' => getenv('DB_GAME_HOST'),
            'port' => getenv('DB_GAME_PORT'),
            'database' => getenv('DB_GAME_DATABASE'),
            'username' => getenv('DB_GAME_USERNAME'),
            'password' => getenv('DB_GAME_PASSWORD'),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_general_ci',
            'prefix' => '',
            'strict' => true,
            'engine' => null,
            'options' => [
                PDO::ATTR_EMULATE_PREPARES => false, // Must be false for Swoole and Swow drivers.
            ],
            'pool' => [
                'max_connections' => 5,
                'min_connections' => 1,
                'wait_timeout' => 3,
                'idle_timeout' => 60,
                'heartbeat_interval' => 50,
            ],
        ],
        'biqi_service' => [
            'driver' => 'mysql',
            'host' => getenv('DB_SERVICE_HOST'),
            'port' => getenv('DB_SERVICE_PORT'),
            'database' => getenv('DB_SERVICE_DATABASE'),
            'username' => getenv('DB_SERVICE_USERNAME'),
            'password' => getenv('DB_SERVICE_PASSWORD'),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_general_ci',
            'prefix' => '',
            'strict' => true,
            'engine' => null,
            'options' => [
                PDO::ATTR_EMULATE_PREPARES => false, // Must be false for Swoole and Swow drivers.
            ],
            'pool' => [
                'min_connections' => 5,  // 最小连接数
                'max_connections' => 100, // 最大连接数
                'idle_timeout' => 60,
                'heartbeat_interval' => 50,
                'connect_timeout' => 10,
                'wait_timeout' => 5,
                'heartbeat' => -1,
                'max_idle_time' => 60,
            ],
        ],
        'biqi_merchant' => [
            'driver' => 'mysql',
            'host' => getenv('DB_MERCHANT_HOST'),
            'port' => getenv('DB_MERCHANT_PORT'),
            'database' => getenv('DB_MERCHANT_DATABASE'),
            'username' => getenv('DB_MERCHANT_USERNAME'),
            'password' => getenv('DB_MERCHANT_PASSWORD'),
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_general_ci',
            'prefix' => '',
            'strict' => true,
            'engine' => null,
            'options' => [
                PDO::ATTR_EMULATE_PREPARES => false, // Must be false for Swoole and Swow drivers.
            ],
            'pool' => [
                'max_connections' => 5,
                'min_connections' => 1,
                'wait_timeout' => 3,
                'idle_timeout' => 60,
                'heartbeat_interval' => 50,
            ],
        ],
    ],
];